package com.shareit.ocr.domain.template;

import java.util.ArrayList;
import java.util.List;

/**  
* 基础字段模版
*  
* @author geai
* @date 2018年1月19日  新建  
*/
public class InvoiceDataFieldsTemplate{
	
	protected List<InvoiceDataField> fields = new ArrayList<InvoiceDataField>();
	
	/*
	public List<InvoiceDataField> getFields() {
		return fields;
	}
	*/
	
	
	public InvoiceDataFieldsTemplate() {}
	
	public void setFieldValue(String name,String value) {
		for(InvoiceDataField f:fields) {
			if(f.getName().equals(name)) {
				f.setValue(value);
			}
		}
	}
	
	public String getFieldValue(String name) {
		String value = "";
		for(InvoiceDataField f:fields) {
			if(f.getName().equals(name)) {
				value = f.getValue();
			}
		}
		
		return value;
	}

	public  List<InvoiceDataField> getFields(){
		return this.fields;
	}
	
	public Object copy() {
		InvoiceDataFieldsTemplate ift = new InvoiceDataFieldsTemplate();
		for(InvoiceDataField f:this.fields) {
			ift.fields.add(f.copy());
		}

		return  ift;
	}
	
	public void setDataFields(Object obj) {};
	
	public String getSplitChar() {
		return "";
	}
	@Override
	public String toString() {
		return "{" +
				 fields +
				'}';
	}
	
}
